package com.itisyue.fun.dto;

import java.util.HashMap;
import java.util.Map;

public enum ErrorCode {
    SUCCESS("200","success"),
    BUSINESS("300","业务异常"),
    ERR_VALIDATION("400", "参数校验失败"),
    CONCURRENCY_FAILURE("409", "并发访问失败"),
    METHOD_NOT_SUPPORTED("405", "http method不允许"),
    INTERNAL_SERVER_ERROR("500", "http 系统内部错误");



    private static final Map<String, ErrorCode> LOOKUP = new HashMap<>();
    static {
        for(ErrorCode errorCode: ErrorCode.values()){
            LOOKUP.put(errorCode.value, errorCode);
        }
    }
    private final String value;
    private final String desc;

    ErrorCode(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static Map<String, ErrorCode> getLOOKUP() {
        return LOOKUP;
    }

    public String getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }
}
